!function() {
    getApp();
    var e = require("../../../siteinfo.js");
    Page({
        data: {
            userInfo: "",
            nickname: "",
			face: "",
			mobile: ""
        },
        onLoad: function(e) {
            var o = wx.getStorageSync("userInfo"), n = o.nickname, a = o.avatar, m = o.mobile;
            this.setData({
                nickname: n,
				face: a,
				mobile:m
            });
		},
		
		onAvatarChange: function() {
			var t = this, url=e.siteroot + "/app/upload/upload";
			wx.chooseImage({
				count: 1,
				success: function(a) {
					a.tempFilePaths[0], t.setData({
						"staff.avatar_file": a.tempFilePaths[0],
						"face": ""
					}), wx.uploadFile({
						url: url,
						filePath: a.tempFilePaths[0],
						name: "file",
						formData: {
							path: a.tempFilePaths[0]
						},
						success: function(a) {
							a.data = JSON.parse(a.data), console.log('a.data',a.data),
							t.setData({
								face: a.data.urls
							});
						}
					});
				}
			});
		},


        getAvaNickData(t) {
			var _that = this;
			var token = wx.getStorageSync("userToken");
			if (!_that.data.face) return wx.showToast({
                title: "请设置您的头像",
                icon: "none",
                duration: 2e3
            });
            if (!t.detail.value.nickname) return wx.showToast({
                title: "请设置您的昵称",
                icon: "none",
                duration: 2e3
            });
			wx.request({
				url: e.siteroot + "/app/Exp/wxappLogin3",
				method: "POST",
				header: {
					"Content-Type": "application/x-www-form-urlencoded"
				},
				data: {
					token: token,
					nickname: t.detail.value.nickname,
					avatar: _that.data.face
				},
				success: function(e) {
					console.log("o", e), 1 == e.data.code ? wx.switchTab({
						url: "/pages/member/index/index"
					}) : wx.showModal({
						title: "提示",
						content: e.data.msg
					});
				}
			});
        },
        onReady: function() {},
        onShow: function() {},
        onHide: function() {},
        onUnload: function() {},
        onPullDownRefresh: function() {},
        onReachBottom: function() {},
        onShareAppMessage: function() {}
    });
}();